package com.sl.au.repository;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.UseCountView;

@Transactional(readOnly = true)
public interface UseCountRepository extends JpaRepository<UseCountView, String>{
	@Query("select n from UseCountView n where n.cPartName like '%'+?1+'%' or n.cPartPicNum like '%'+?1+'%' or n.cMaterial like '%'+?1+'%'")
	Page<UseCountView> getPage(String key,Pageable pageable);
	@Query("select count(*) from UseCountView n where n.cPartName like '%'+?1+'%' or n.cPartPicNum like '%'+?1+'%' or n.cMaterial like '%'+?1+'%'")
	long getCount(String key);
	
	@Query("select n from UseCountView n ")
	Page<UseCountView> getPage(Pageable pageable);
	@Query("select count(*) from UseCountView n")
	long getCount();
}
			